//---------------------------------------------------------------------------

#ifndef TCheckMapH
#define TCheckMapH
//---------------------------------------------------------------------------
#include <types.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>

#include "TCurve.h"
#include "TProfile.h"
#include "TCut.h"
#include "TSpeedTimePosition.h"
#include "TRetarder.h"
#include "TCtrRetarder.h"
#include "TArrester.h"
class TCheckMap
{
private:
   TPoint PlanBase;
   TPoint VTSBase;
   TPoint ProfileBase;

   TTracks *Tracks;
   TProfile * Profile;
   TSwitches * Switches;
   TCurves * Curves;
   TVTS * VTS;
   TCuts * Cuts;

   TRetarders * Retarders;
   TCtrRetarders * CtrRetarders;
   TArresters * Arresters;


   unsigned short Height;
   unsigned short Width;
   int PlanMiddle;
   float TimeScale;
   float VScale;
   float LengthScale;
   int HundredHeight;
   int TenHeight;
   TCanvas *Canvas;
   unsigned short TrackNumber;


   int __fastcall CY(const int y, const TPoint Base);
   int __fastcall CX(const float XPosition);
   bool __fastcall SetScale(void);
   bool __fastcall DrawPlan(void);
   bool __fastcall DrawHump(void);
   bool __fastcall DrawCurves(void);
   bool __fastcall DrawSwitches(void);
   bool __fastcall DrawProfile(void);
   bool __fastcall DrawVTS(void);
   bool __fastcall DrawVTSBorder(void);
   bool __fastcall DrawWholeSpeed(void);
   bool __fastcall DrawWholeTime(void);    //Todo 3 -o Li Wenjian : Check this function.
   bool __fastcall DrawLengthGraduate(const int Graduate, const int GraduateHeight, const bool Show);
   bool __fastcall DrawSpeedGraduate(void);
   bool __fastcall DrawBaseRetarderPos(const float Begin, const float End, TColor Color);
   bool __fastcall DrawRetarderPos(TRetarders * Retarders,
								   TCtrRetarders * CtrRetarders,
                                   TArresters * Arresters);
   void __fastcall DrawTime(const float Time, const float Position, const float Length);
   void __fastcall DrawSpeed(const float Speed, const float PreSpeed, const float Position, const float PrePosition);
public:
   int SwitchWidth;
   int CurveWidth;
   int HumpWidth;
   float PlanHeight;
   float ProfileHeight;
   float MaxTime;
   float MaxSpeed;
   float MaxLength;
   bool __fastcall Draw(void);
   void __fastcall Show(const unsigned short ShowTrackNumber, TCanvas *ShowCanvas,
                        const unsigned short Width, const unsigned short Height);
   bool __fastcall SetBasePoint(void);
   __fastcall TCheckMap();

   bool __fastcall Initicalize(TTracks * Tracks,
                               TCuts * Cuts,
                               TRetarders * Retarders,
                               TCtrRetarders * CtrRetarders,
                               TArresters * Arresters,
                               TVTS * tVTS, TCanvas * ShowCanvas);


   void __fastcall DrawInitMap(const unsigned short WhichTrack);
   void __fastcall DrawTimeSpeed(const float Speed, const float PreSpeed,
                                 const float Time, const float Position, const float PrePosition, const float Length);
};

#endif
